﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using QuizEngine.Data;

namespace QuizEngine.Presentation
{
    public partial class ChoiceQuiz : Form
    {
        string _admin = "";
        public delegate void PassSender(object sender);
        public PassSender passSender;
        QuizEngineEntities _quizEngineEnt = new QuizEngineEntities();

        public ChoiceQuiz()
        {
            InitializeComponent();
        }

        private void lblChoiceQuiz_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (this.passSender != null)
            {
                passSender(_quizEngineEnt.Quizzes.Find(cbbChoiceQuiz.SelectedValue));
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
            this.Dispose();
        }

        private void ChoiceQuiz_Load(object sender, EventArgs e)
        {
            /*
            this.Focus();
            this.timerEeasterEgg.Start();
            quizTblAdapter.Fill(quizEngineDS.Quiz);
            cbbChoiceQuiz.DataSource = quizEngineDS.Quiz;
            cbbChoiceQuiz.DisplayMember = "QuizName";
            cbbChoiceQuiz.ValueMember = "QuizId";
             * */
        }

        private void ChoiceQuiz_KeyPress(object sender, KeyPressEventArgs e)
        {

        }

        private void timerEeasterEgg_Tick(object sender, EventArgs e)
        {
            _admin = "";
        }

        private void cbbChoiceQuiz_KeyPress(object sender, KeyPressEventArgs e)
        {
            _admin += e.KeyChar;
            if (_admin.Equals("Administrator", StringComparison.CurrentCultureIgnoreCase))
            {
                this.Height += 30;
                //this.txbUserName.Visible = true;
                //this.txbPassword.Visible = true;
                //this.
                AdminForm admin = new AdminForm();
                admin.ShowDialog();
                this.Close();
                this.Dispose();
            }
        }


    }
}
